package MovieFinderApp.MCMovieOutput;

import java.beans.PropertyChangeEvent;
import MovieFinderApp.LCMovieInterfaces.IMovie;
import MovieFinderApp.MCMOvieOutputInterfaces.IMovieOutput;

public class MovieOutput implements IMovieOutput{
    
    public MovieOutput(){
        
    }
    
	private void print(IMovie movie_arr[]){
		if(movie_arr.length == 0)
			System.out.println("keine Filme gefunden");
		else
			System.out.println("==================== Filme ====================");

		for(int i=0; i<movie_arr.length; i++){
			System.out.println(movie_arr[i].getTitle()+" : "+movie_arr[i].getDirector());
		}
	}

	@Override
	public void propertyChange(PropertyChangeEvent evt) {
		if(evt.getPropertyName().equals("movieArray")){
			print((IMovie[])evt.getNewValue());
		}
	}
}
